<template>
  <div class="top">
    <div class="heade">
      <p @click="Goback()">
        <i class="iconfont icon-fanhui"></i>
      </p>
      <p>排行榜</p>
      <p>
        <span class="iconfont icon-dian"></span>
        <span class="iconfont icon-yuanxinyuan"></span>
      </p>
    </div>
    <div class="maine">
      <div class="tops">
        <div class="two" v-for="(v, i) in list.slice(0, 3)" :key="i">
          <p><img :src="'http://47.111.14.227:7001' + v.b_avatar" alt="" /></p>
          <p>No.{{ i+1 }}</p>
          <p>{{ v.b_nickname }}</p>
        </div>
      </div>

      <div
        class="foots"
        v-for="(item, index) in list.slice(3, 5)"
        :key="index"
        @click="Detail(item.b_id)"
      >
        <p class="foo">
          <span>{{ index+4}}</span>
          <span class="image"
            ><img :src="'http://47.111.14.227:7001' + item.b_avatar" alt=""
          /></span>
          <span>
            <p>{{ item.b_nickname }}</p>
            <p>{{ item.company }}</p>
          </span>
          <span class="iconfont icon-xiaoxi" @click="Mess()"></span>
          <span class="iconfont icon-dianhua"></span>
        </p>
      </div>
    </div>
  </div>
</template>

<script>
import axios from "../../utils/axios";
export default {
  data() {
    return {
      list: [],
    };
  },
  methods: {
    Goback() {
      this.$router.push("/home");
    },
    Mess() {
      this.$router.push("");
    },
    Detail(id) {
      this.$router.push(`/detailed/${id}`);
    },
  },
  created() {
    axios.get("/rankingList").then((res) => {
      this.list = res.data.list;
      console.log(this.list, "top");
    });
  },
};
</script>

<style>
.top {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}
.heade {
  display: flex;
  width: 100%;
  height: 50px;
  align-items: center;
  justify-content: space-between;
  background-color: rgb(70, 142, 224);
  color: #fff;
}
.heade p {
  padding: 0 10px;
}
.heade p:nth-child(3) {
  border: 1px solid #fff;
  border-radius: 20px;
  padding: 3px 5px;
  margin-right: 20px;
}
.heade p span {
  margin-left: 10px;
}
.maine {
  width: 100%;
  height: 100%;
  flex: 1;
  overflow-y: scroll;
}
.tops {
  width: 100%;
  height: 220px;
  background-color: rgb(247, 120, 120);
  display: flex;
  padding: 0 10px;
}
.tops img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  margin-left: 30%;
  margin-top: 10px;
}
.two{
  margin-left: 5px;
  width: 35%;
  background-color: #fff;
  line-height: 30px;
  text-align: center;
}
.two:nth-child(1){
  height: 160px;
  margin-top: 70px;
  border-radius: 20px 20px 0 0 ;
}
.two:nth-child(2){
  height: 170px;
  margin-top: 50px;
  border-radius: 20px 20px 0 0 ;
}
.two:nth-child(3){
  height: 140px;
  margin-top: 90px;
  border-radius: 20px 20px 0 0 ;
}

.foot {
  width: 100%;
  height: 100%;
}
.foo {
  padding: 0 20px;
  width: 100%;
  height: 80px;
  display: flex;
  border-bottom: 1px solid #ccc;
  align-items: center;
}
.foo span {
  margin-left: 10px;
  line-height: 30px;
}
.foo span:nth-child(4) {
  margin-left: 80px;
}
.image {
  width: 50px;
  height: 50px;
  margin-left: 10px;
}
.image img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}
.icon-xiaoxi {
  width: 40px;
  height: 40px;
  text-align: center;
  border: 1px solid rgb(235, 160, 172);
  padding: 5px;
  color: red;
  border-radius: 50%;
  background-color: rgb(235, 160, 172);
}
.icon-dianhua {
  width: 40px;
  height: 40px;
  text-align: center;
  border: 1px solid rgb(235, 160, 172);
  padding: 5px;
  color: red;
  border-radius: 50%;
  background-color: rgb(235, 160, 172);
  margin-left: 300px;
}
.foo span p:nth-child(2) {
  color: #999;
}
</style>